//
// Created by Administrator on 2020/10/28.
//

#include <stdatomic.h>
#include "../../include/utils/objArc.h"

void OARC_Init(S_ObjArc *self, int32_t refCount)
{
    atomic_store(&self->refCount, refCount);
}

int32_t OARC_IncCount(S_ObjArc *self)
{
    return atomic_fetch_add(&self->refCount, 1);
}

int32_t OARC_DecCount(S_ObjArc *self)
{
    return atomic_fetch_sub(&self->refCount, 1);
}

int32_t OARC_GetCount(S_ObjArc *self)
{
    return atomic_load(&self->refCount);
}
